<?php

/**
 * @author Do Van Tien
 * @email dovantien2911@gmail.com
 * @company Webbox.com.vn
 * @copyright 2012
 */

 
?>
<div class="content content-comment padding-10 margin-10 background-color-f4f4f4 border-1 border-radius-8 border-color-ccc border-style-solid">
    <div class="target">
        <a href="<?php echo base_url().$this->lang->lang()."/admin/manage";?>" class="hover-blue no-underline"><?php echo lang('backend.homepage');?></a> &raquo;
        <a href="<?php echo base_url().$this->lang->lang()."/admin/site_comment/video";?>" class="hover-blue no-underline">Quản lý bình luận video</a> 
    </div>
    <div class="clear-both"></div>
    <table border="0" cellpadding="0" cellspacing="0" class="table-list-item">
        <tr class="head">
            <td class="row-1"><?php echo lang('backend.no');?></td>
            <td class="row-2"><?php echo lang('backend.id');?></td>
            <td class="row-3"><?php echo lang('backend.name');?></td>
            <td class="row-4"><?php echo lang('backend.content');?></td>
            <td class="row-7"><?php echo lang('backend.status');?></td>
            <td class="row-5"><?php echo lang('backend.user');?></td>
            <td class="row-5"><?php echo lang('backend.video');?></td>
            <td class="row-6"><?php echo lang('backend.dateset');?></td>
            <td class="row-6"><?php echo lang('backend.alert');?></td>
        </tr>
        <?php $stt = 1; foreach($comment_list as $row){ ?>
        <tr class="row">
            <td class="row-1 text-align-center"><?php echo $stt;?></td>
            <td class="row-2 text-align-center"><?php echo $row['ID'];?></td>
            <td class="row-3"><a href="<?php echo base_url().$this->lang->lang()."/admin/site_comment/video_edit/".$row['ID'];?>" title="<?php echo lang('backend.edit');?>" class="color-blue hover-underline"><?php echo $row['Name'];?></a></td>
            <td class="row-4 width-400">
                <div class="contentComment">
                    <span class="hiddenComment text-align-justify"><?php echo $row['Content'];?></span>
                    <div class="clear-both margin-top-5">
                        <a href="<?php echo base_url().$this->lang->lang()."/admin/site_comment/video_uncheck/".$row['ID'];?>" title="Không duyệt comment" index="<?php echo $row['ID'];?>" class="bntLockComment ajax float-right color-black hover-color-blue"><?php echo lang('backend.hidden');?></a>
                        <a href="<?php echo base_url().$this->lang->lang()."/admin/site_comment/video_check/".$row['ID'];?>" title="Duyệt comment" index="<?php echo $row['ID'];?>" class="bntCheckComment ajax float-right margin-right-10 ajax color-black hover-color-blue"><?php echo lang('backend.show');?></a>
                        <a href="#" class="showComment float-right margin-right-10 color-blue no-underline hover-underline"><?php echo lang('backend.showcontent');?></a>
                    </div>
                </div>
            </td>
            <td class="row-7"><?php if($row['Status'] == 1) echo "<div class=\"bntActive bntCommentAjax\"></div>";elseif($row['Status'] == 2) echo "<div class=\"bntLock bntCommentAjax\"></div>";else echo "<div class=\"bntNoActive bntCommentAjax\"></div>";?></td>
            <td class="row-5"><?php echo $row['UName'];?></td>
            <td class="row-5"><?php echo $row['VName'];?></td>
            <td class="row-6"><?php echo _dataToDate($row['Dateset']);?></td>
            <td class="row-6 text-align-center"><?php echo $row['Alert'];?></td>
        </tr>
        <?php $stt++; } ?>
    </table>
    
    <script type="text/javascript">
        $(document).ready(function(){
            $(".showComment").click(function(){
                $(this).parent().parent().find("span").toggleClass("hiddenComment");
                if($(this).text() == "Hiện comment"){
                    $(this).text("Ẩn comment");
                }else{
                    $(this).text("Hiện comment");
                }
                return false;
            });
            $(".bntCheckComment.ajax").click(function(){
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").removeClass("bntLock");
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").removeClass("bntNoActive");
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").removeClass("bntActive");
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").addClass("bntActive");
                str = $(this).attr("index");
                $.post("<?php echo base_url().$this->lang->lang();?>/ajax/checkCommentVideo/"+str, {
                    id : str,
                },function(data){
                    
                }); 
                return false;
            });
            $(".bntLockComment.ajax").click(function(){
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").removeClass("bntLock");
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").removeClass("bntNoActive");
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").removeClass("bntActive");
                $(this).parent().parent().parent().parent().find(".bntCommentAjax").addClass("bntLock");
                str = $(this).attr("index");
                $.post("<?php echo base_url().$this->lang->lang();?>/ajax/uncheckCommentVideo/"+str, {
                    id : str,
                },function(data){
                    
                }); 
                return false;
            });
        });
    </script>
    <div class="clear-both"></div>
</div>